import App from './App'
import { createSSRApp } from 'vue'
import utils from '@/utils/utils.js'
import uviewPlus from 'uview-plus'
import {initRequest} from '@/utils/request/index'
import pinia from '@/stores'
import XHPop from '@/utils/pop.js'
import auth from '@/utils/auth.js'

export function createApp() {
  const app = createSSRApp(App)
  //工具类挂载到全局uni对象上
  uni.$tools = utils
  uni.$auth = auth
  //注册网络请求工具
  initRequest(app)
  //注册uviewPlus组件库
  app.use(uviewPlus)
  //注册pinia状态管理插件
  app.use(pinia)
  //注册自定义全局弹框插件
  app.use(XHPop)
  
  return {
    app
  }
}